package com.example.androidcomplete0102.ch17;

import java.io.File;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;

import com.example.androidcomplete0102.R;

public class CallOther extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch17_callother);
	}
	
	public void mOnClick(View v){
		Intent intent = null;
		switch(v.getId()){
		case R.id.ch17_web:
			intent = new Intent(intent.ACTION_VIEW, Uri.parse("http://www.naner.com"));
			break;
		case R.id.ch17_dial:
			intent = new Intent(intent.ACTION_DIAL, Uri.parse("tel:010-1234-1234"));
			break;
		case R.id.ch17_picture:
			intent = new Intent(intent.ACTION_VIEW);
			String sd = Environment.getExternalStorageDirectory().getAbsolutePath();
			Log.d("외부경로", sd);
			//Uri uri= Uri.fromFile(new file(sd+"/Download/andExam.png"));
			Uri uri = Uri.fromFile(new File(sd+"/psh.jpg"));
			intent.setDataAndType(uri,"image/jpg");
			break;
		case R.id.ch17_other:
			//intent = new Intent(intent.ACTION_MAIN);
			//intent.setComponent(new ComponentName("exam.memo", "exam.memo.Memo"));
			//intent.setClassName("kr.hkit.androidcomplete001", "kr.hkit.androidcomplete001.MainAcitivity");

			//intent = new Intent("kr.hkit.androidcomplete01.chapter11.MAIN11");
			//break;//다른 프로그램에서 일부 액티비티만 실행 (해당 매니피스트에 인텐트 필터에 액션네임과 카테고리 디폴트를 추가 해야한다.
			
			intent = new Intent("ARROWBTN");
			break;
			
		/*case R.id.ch17_other:
			intent = new Intent("com.example.androidcomplete0102.ch17.ADD");
			intent.putExtra("left", 6);
			intent.putExtra("right", 7);
			break;*/
		}
		startActivity(intent);
	}
}
